from app.models.BaseModel import BaseModel
from app.db import db
class SoapOperaModel(BaseModel):
    id=db.Column(db.Integer, primary_key=True, autoincrement=True)
    title = db.Column(db.String(100), nullable=True)
    description = db.Column(db.String(500), nullable=True)
    type = db.Column(db.String(50), nullable=True)
    director = db.Column(db.String(50), nullable=True)
    year = db.Column(db.Integer, nullable=True)
    rating = db.Column(db.Float, nullable=True)
    cover = db.Column(db.String(100), nullable=True)
    episodes = db.Column(db.Integer, nullable=True)
    

    def __repr__(self) -> str:
        return f"SoapOperaModel(id={self.id}, title={self.title}, description={self.description}, type={self.type}, director={self.director}, year={self.year}, rating={self.rating}, cover={self.cover}, episodes={self.episodes})"
        
    def to_dict(self):
        return {
            "id": self.id,
            "title": self.title,
            "description": self.description,
            "type": self.type,
            "director": self.director,
            "year": self.year,
            "rating": self.rating,
            "cover": self.cover,
            "episodes": self.episodes
        }
    